import request from '@/utils/request'

/**
 * 查询等级列表
 * http://192.168.88.247:4999/web/#/80
 * @param {*} data
 * @returns
 */
export function listLevel (data) {
  return request({
    url: '/v1/level/list',
    // method: 'get',
    // params: query
    method: 'post',
    data
  })
}

/**
 * 会员等级下拉选择数据
 * http://192.168.88.247:4999/web/#/80
 * @returns
 */
// export function getLevelOption () {
//   return request({
//     url: '/v1/level/list',
//     method: 'get'
//   })
// }

/**
 * 新增等级
 * http://192.168.88.247:4999/web/#/80
 * @param {*} data
 * @returns
 */
export function addLevel (data) {
  return request({
    url: '/v1/level/create',
    method: 'post',
    data: data
  })
}

/**
 * 修改等级
 * http://192.168.88.247:4999/web/#/80
 * @param {*} data
 * @returns
 */
export function updateLevel (data) {
  return request({
    url: '/v1/level/update',
    method: 'put',
    data: data
  })
}

/**
 * 删除等级
 * http://192.168.88.247:4999/web/#/80
 * @param {*} levelId 删除的等级id
 * @returns
 */
export function delLevel (id) {
  return request({
    url: '/v1/level/del',
    method: 'delete',
    data: { id }
  })
}

/**
 * 等级上下架
 * http://192.168.88.247:4999/web/#/80
 * @param {*} level_id 等级ID
 * @param {*} status 状态
 * @returns
 */
export function updateStatus (id) {
  return request({
    url: '/v1/level/shelf',
    method: 'post',
    data: { id }
  })
}
